<?php
//
//	file: includes/reports/reports_main.php
//	begin: 30/04/2007
//	$Author: christopher $
//	$Revision: 14 $
//	$Date: 2007-10-08 14:55:03 +0000 (Mon, 08 Oct 2007) $
//	license: http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL)
//
//	description: loader for reports

if ( !defined('REPORT_CURRENT_VERSION') )
{
	// constants
	define('REPORT_CURRENT_VERSION', '0.9.0');

	// Auth (only for auth.php, in order to be able to hit regen and get back this one)
	define('AUTH_REPORT_NOTIFY', 66);

	// Tables
	define('REPORTS_TABLE', $table_prefix . 'reports');
	define('REPORTS_REASON_TABLE', $table_prefix . 'reports_reason');
}

// do not go further during login or installation
if ( defined('IN_LOGIN') || defined('IN_INSTALL') )
{
	return;
}

// intall directory still present
if ( file_exists(phpbb_realpath($config->root . 'install_rep')) )
{
	if ( $config->data['mod_reports'] != REPORT_CURRENT_VERSION )
	{
		header('Location: ' . $config->url('install_rep/install'));
		exit;
	}
	else
	{
		message_die(GENERAL_MESSAGE, 'Please remove install_rep/ directory');
	}
}

if ( !$config->data['mod_reports'] )
{
	return;
}

class reports_version
{
	function read(&$data)
	{
		$data[] = array('app_name' => 'Reports', 'app_desc' => '', 'app_marker' => 'mod_reports', 'app_author' => 'impleri', 'app_author_url' => 'http://impleri.net/', 'app_server' => 'mods.impleri.net', 'app_file' => '/download/versions.dta', 'app_protocol' => 'native', 'app_page' => 'http://mods.impleri.net/download.php');
	}
}

class reports_notify
{
	function read(&$data)
	{
		$data[] = 'user_notify_report';	// notify on a reported post
		$data[] = 'user_notify_karma';	// notify on a change in karma
	}
}

$config->set_plug_ins('mod_reports', array(
	'posting' => array(
		'layer' => array('includes/reports/class_reports_display', 'includes/reports/class_reports_parent', 'includes/reports/class_reports_' . POSTING),
		'object' => 'reports_posting',
	),
	'privmsg' => array(
		'layer' => array('includes/reports/class_reports_display', 'includes/reports/class_reports_parent', 'includes/reports/class_reports_privmsg'),
		'object' => 'reports_privmsg',
	),
	'modcp' => array(
		'layer' => 'includes/reports/class_reports_handler',
		'object' => 'reports_handler',
	),
	'viewtopic' => array(
		'layer' => 'includes/reports/class_reports_viewtopic',
		'object' => 'reports_viewtopic',
	),
	'class_forums' => array(
		'layer' => 'includes/reports/class_reports_plug_ins',
		'object' => 'reports_forums',
	),
	'class_posts' => array(
		'layer' => 'includes/reports/class_reports_display',
		'object' => 'reports_display',
	),
	'class_topics_attr' => array(
		'layer' => 'includes/reports/class_reports_plug_ins',
		'object' => 'reports_topics_attr',
	),
	'class_versions' => array(
		'object' => 'reports_version',
	),
	'class_advnot_parent' => array(
		'object' => 'reports_notify',
	),
));
?>